import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

/**
 * @author whitscot
 */
public class gui extends JFrame implements ActionListener{
    
    JPanel loadPane = new JPanel();
    
    JButton newGame;
    JButton loadGame;
    
    gui(){
        this.setSize(800, 800);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
        this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        this.setLayout(null);
        this.getContentPane().add(loadPane);
        //this.setTitle(Globals.GAME_TITLE);
        
        
        loadPane.setSize(800, 800);
        loadPane.setLocation(0, 25);
        loadPane.setLayout(null);
        swapPanes(loadPane);
        
        newGame = new JButton();
        newGame.setBounds(250, 50, 300, 50);
        newGame.setText("New Game");
        newGame.addActionListener(this);
        loadPane.add(newGame);
        
        loadGame = new JButton();
        loadGame.setBounds(250, 200, 300, 50);
        loadGame.setText("Load Game");
        loadGame.addActionListener(this);
        loadPane.add(loadGame);
    }
    
    /**
     * removes all panes from the gui
     */
    public boolean swapPanes(JPanel newPane){
        try {
            getContentPane().removeAll();
            getContentPane().add(newPane);
        } catch (Exception e){
            System.out.println(e);
            return false;
        }
        return true;
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    public static void main(String[] args) {
        gui t = new gui();
    }
    
}
